home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / vbpong1a / dinputco.bas < prev    next >
Encoding:
BASIC Source File  |  1999-08-09  |  2.2 KB  |  94 lines

  1. Attribute VB_Name = "DInputCode"
  2. Public myInput As CDXVBInput
  3.  
  4. Public Sub InitDInput()
  5.     GUIDDEFS.GUID_Initialize
  6.     
  7.     Set myInput = New CDXVBInput
  8.     myInput.Create App.hInstance, main2.hWnd
  9.     myInput.ReAcquire
  10. End Sub
  11.  
  12. Public Sub HandleInput()
  13.     myInput.UpdateKeyboard
  14.     
  15.     If Keys(DIK_ESCAPE) Then bActive = False
  16.     
  17.     If Keys(DIK_RETURN) Then bIns = False
  18.     
  19.     If Keys(DIK_RETURN) Then
  20.         If bWinner = True Then
  21.             ' Reset game
  22.             bWinner = False
  23.             bLoaded = False
  24.             bPlayer1Won = False
  25.             bPlayer2Won = False
  26.             bIns = True
  27.             
  28.             Call BlockCode.InitBlocks
  29.             
  30.             Player1.x = 10
  31.             Player1.y = 175
  32.             Player2.x = 620
  33.             Player2.y = 175
  34.  
  35.             myBall1.x = 10
  36.             myBall1.y = 10
  37.             myBall1.xvel = 5
  38.             myBall1.yvel = 5
  39.  
  40.             myBall2.x = 619
  41.             myBall2.y = 10
  42.             myBall2.xvel = -5
  43.             myBall2.yvel = 5
  44.             
  45.             bTP = False
  46.         End If
  47.     End If
  48.     
  49.     If Keys(DIK_R) Then
  50.         ' Reset game
  51.         bWinner = False
  52.         bLoaded = False
  53.         bPlayer1Won = False
  54.         bPlayer2Won = False
  55.         bIns = True
  56.             
  57.         Call BlockCode.InitBlocks
  58.             
  59.         Player1.x = 10
  60.         Player1.y = 175
  61.         Player2.x = 620
  62.         Player2.y = 175
  63.  
  64.         myBall1.x = 10
  65.         myBall1.y = 10
  66.         myBall1.xvel = 5
  67.         myBall1.yvel = 5
  68.  
  69.         myBall2.x = 619
  70.         myBall2.y = 10
  71.         myBall2.xvel = -5
  72.         myBall2.yvel = 5
  73.     End If
  74.     
  75.     If Keys(DIK_P) Then bPaused = Not bPaused
  76.     
  77.     If bInstructions = False Then
  78.         If Keys(DIK_UP) Then
  79.             Player2.SetVel -6
  80.         ElseIf Keys(DIK_DOWN) Then
  81.             Player2.SetVel 6
  82.         ElseIf Not (Keys(DIK_UP) And Keys(DIK_DOWN)) Then
  83.             Player2.SetVel 0
  84.         End If
  85.         If Keys(DIK_A) Then
  86.             Player1.SetVel -6
  87.         ElseIf Keys(DIK_Z) Then
  88.             Player1.SetVel 6
  89.         ElseIf Not (Keys(DIK_A) And Keys(DIK_Z)) Then
  90.             Player1.SetVel 0
  91.         End If
  92.     End If
  93. End Sub
  94.